package com.example.imooccommon.util;


import lombok.Data;
import lombok.ToString;

/**
 * @Author Anita
 * @Date 2018/1/17 17:32
 */
@Data
@ToString
public class JsonView {

    private Integer errcode = 0;

    private String message;

    private Object data;

    public JsonView(Integer errcode,String message,Object data){
        this.errcode = errcode;
        this.message = message;
        this.data = data;
    }


    public JsonView(Integer errcode,String message) {
        this.errcode = errcode;
        this.message = message;
    }

    public JsonView(Integer errcode){
        this.errcode = errcode;
    }

    public JsonView(){}


    public static  JsonView render(Object data){
        JsonView tmp = new JsonView(0,"success",data);
        return tmp;
    }

    public static JsonView render(Integer errcode){
        JsonView tmp = new JsonView(errcode,"");
        return tmp;
    }

    public static  JsonView render(Integer errcode,String message){
        JsonView tmp = new JsonView(errcode,message);
        return tmp;
    }

    public static JsonView render(Integer errcode, String message, Object data){
        JsonView tmp = new JsonView(errcode, message, data);
        return tmp;
    }




}
